// 导入baseService
import { fetch, apiFormat, apiFormat2 } from '@/service/baseService';

const listApi = '/api/car-center/chauffeur';                                // 司机中心列表            method 'GET'
const saveApi = '/api/car-center/chauffeur';                                // 新增司机信息            method 'POST'
const getOneApi = '/api/car-center/chauffeur/{id}';                     // 通过ID获取信息            method 'GET'

const updateApi = '/api/car-center/chauffeur/{id}';                     // 司机修改               method 'PUT'
const deleteApi = '/api/car-center/chauffeur/{id}';                     // 司机删除               method 'DELETE'

/**
 * 列表
 */
export default {
  /* GET */
  /**
   * 获取当前司机
   * @param fnSuccess 成功回掉
   * @param fnFail    失败回掉
   * @return void
   */
  getOne: (opt) => fetch.get(apiFormat(getOneApi, opt)),
  /* GET */
  /**
   * 获取司机列表
   * @param fnSuccess 成功回掉
   * @param fnFail    失败回掉
   * @return void
   */
  getList: (opt, payload) => fetch.get(apiFormat2(listApi, opt), payload),
  /**
 * 司机新增
 * @param fnSuccess 成功回掉
 * @param fnFail    失败回掉
 * @return void
 */
  saveApi: (payload) => fetch.post(saveApi, payload),
  /* UPDATE */
  /**
   * 司机修改
   * @param fnSuccess 成功回掉
   * @param fnFail    失败回掉
   * @return void
   */
  updateApi: (opt, payload) => fetch.put(apiFormat(updateApi, opt), payload),
  /**
   * 删除司机
   * @param payload
   */
  deleteApi: (opt, payload) => fetch.delete(apiFormat(deleteApi, opt), payload)

};
